Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instance option to append a CSS class for rows #2606

Closed
wants to merge 1 commit into from
Closed

Add instance option to append a CSS class for rows #2606

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Apr 6, 2016

As Rails Admin uses Bootstrap, I wanted to use the table's contextual classes in my lists.
This is an approach to implement that using a method declared in RailsAdmin::Config, it has access to the object being rendered into the row.

Usage

RailsAdmin.config do |config|
config.model Event do
  list do
    row_css_class do
      bindings[:object].mode == 'panic' ? 'danger' : 'success'
    end
end

As Rails Admin uses Bootstrap, I wanted to use the tables
contextual classes in my lists.
This is an approach to add classes per list declared in
RailsAdmin::Config.
@mshibuya
Copy link
Member

Test needed!

@ghost
Copy link
Author

ghost commented Aug 13, 2016

indeed, I'll add them soon, @mshibuya; however, do you find it helpful?
I really don't know if there's a better/cleaner way to implement this.

@mshibuya
Copy link
Member

I think this is okay, it's simple and useful 😃

@ghost
Copy link
Author

ghost commented Mar 25, 2017

@mshibuya, I will close this PR in favour of #2860.
It will be great if you can give me another review (after almost 1 year, hehe)

@ghost ghost closed this Mar 25, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant